package cn.devnotes.servletdemo.util;
import java.sql.*;

public class DbUtil {

    /**
     *
     * @param driver
     * @param url
     * @param userName
     * @param password
     * @return
     */
    public static Connection getConnection (String driver, String url, String userName, String password) {
        Connection conn = null;
        try {
            Class.forName(driver);
            conn = DriverManager.getConnection(url, userName, password);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            //
        }
        return conn;
    }
}
